import java.lang.reflect.Array;
import java.util.Arrays;

public class t6 {
    public static void main(String[] args) {
        String str = "PAYPALISHIRING";

        char arr[] = str.toCharArray();
        int num = 4;
        int z = arr.length;
        int len =0;
        while (z>0){
            int p =0;
            z-=num;
            len++;
            while (z>0&&p<num-2 ){
                z--;
                len++;
                p++;
            }
        }
        System.out.println(len);
        char crr[][] = new char[num][len];
        int i = 0;
        int j = 0;
        int k = 0;
        while (k<arr.length){
            while (i<num && k<arr.length){
                crr[i++][j] = arr[k++];
                //System.out.print(arr[k - 1]);
            }
            i-=2;j++;
            while (i>=0 && k<arr.length){
                crr[i--][j++] = arr[k++];
                //System.out.print(arr[k - 1]);

            }
            i+=2;j--;
        }

        StringBuilder s = new StringBuilder();

        for(int m =0;m<crr.length;m++){
            for(int n = 0;n<crr[0].length;n++){
                if(crr[m][n] == '\u0000'){
                    s.append("");
                }else{
                  s.append(crr[m][n]);
                }
                /*System.out.print(crr[m][n]);*/
            }
            //System.out.println("");
            String aa = s.toString();
        }
        System.out.println(s);
        //return s;



    }
}
